package com.fuxi.cloud.desreport.render.a;


import com.alibaba.fastjson.JSONObject;

import java.util.Iterator;
import java.util.List;
import com.fuxi.cloud.desreport.model.RenderInfo;
import com.fuxi.cloud.desreport.model.ReportDbInfo;
import com.fuxi.cloud.desreport.render.b.b;
import com.fuxi.cloud.desreport.render.utils.RenderUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
/**
 * a
 *
 * @Author: 扫地僧
 * @CreateTime: 2021-05-03
 */
@Component("tableGroupRenderStrategy")
public class c extends d {
    private static final Logger a = LoggerFactory.getLogger(c.class);
    private List<b> b;

    public c() {
    }

    @Override
    public boolean support(JSONObject row) {
        return RenderUtil.a(row, new String[]{"group("}, new String[]{"dynamic("});
    }

    @Override
    public JSONObject beforeRenderRow(RenderInfo renderInfo, JSONObject rows, JSONObject currentRow, Integer rowIndex) {
        this.b = RenderUtil.a(currentRow);
        return RenderUtil.a(currentRow, (var0, var1) -> {
            return var1.replace("group(", "").replace(")", "");
        }, new String[]{"group("});
    }

    @Override
    public Object getData(RenderInfo renderInfo, ReportDbInfo reportDbInfo) {
        List var3 = reportDbInfo.getList();

        b var5;
        for(Iterator var4 = this.b.iterator(); var4.hasNext(); var3 = RenderUtil.a(var3, var5.getColumn())) {
            var5 = (b)var4.next();
        }

        return var3;
    }

    @Override
    public JSONObject afterRenderRow(RenderInfo renderInfo, JSONObject row, JSONObject dynamicRowObj, Integer dynamicRowEndIndex) {
        return this.a(renderInfo, dynamicRowObj);
    }
}
